// EODate.cs created with MonoDevelop
// User: awilliam at 2:35 PM 9/25/2008
//
// To change standard headers go to Edit->Preferences->Coding->Standard Headers
//
using System;

namespace Whitemice.EOMono
{
  public class EODate : EOValue
  {
    protected DateTime val;
    
    public EODate() : base()
    {
    } // end ctor
    
    public EODate(DateTime v) : base()
    {
      this.Value = v;
    } // end ctor
    
    public EODate(EODate v) : base()
    {
      this.Value = v.Value;
    } // end ctor
    
    public override object Value
    {
      get { return val; }
      set 
      {
        if (value == null) {
          this.IsNull = true;
        } else
          {
            this.IsNull = false;
            val = Convert.ToDateTime(value); 
          }
      }
    } // end Value
    
    public override string SQLValue()
    {
      if(IsNull) return "NULL";
      return string.Format("\"{0}\"", val.ToString("yyyy-MM-dd"));
    } // end SQLValue
  } // end class
}
